package com.zfx.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * 自定义后置处理器
 */
//@Component
public class LubanBeanPostProcessor implements BeanPostProcessor {

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		if (beanName.equals("memberService")){
 			System.out.println("before InitIalizition");
			return bean;
		}
		return null;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		if (beanName.equals("memberService")){
	 	System.out.println("after InitIalizition");
			return bean;
		}
		return null;
	}
}
